package com.book.bookprojectapplication.login.activity;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;

import com.book.bookprojectapplication.R;
import com.tistory.whdghks913.croutonhelper.CroutonHelper;

import de.keyboardsurfer.android.widget.crouton.Style;

public class RegisterFirstActivity extends Activity {
	Bundle extra = new Bundle();
	CroutonHelper mHelper;
	Button backmainBtn, nextBtn;
	CheckBox checkBox1, checkBox2;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.registerfirst);

		backmainBtn = (Button) findViewById(R.id.backmainBtn);

		backmainBtn.setOnClickListener(new Button.OnClickListener() {

			@Override
			public void onClick(View v) {
				Intent myIntent = new Intent(getApplicationContext(),
						MainActivity.class);
				extra.putString("key", "ok");
				myIntent.putExtras(extra);
				startActivity(myIntent);

			}

		});

		nextBtn = (Button) findViewById(R.id.nextBtn);
		checkBox1 = (CheckBox) findViewById(R.id.checkBox1);
		checkBox2 = (CheckBox) findViewById(R.id.checkBox2);
		mHelper = new CroutonHelper(this);
		mHelper.setDuration(1000);

		nextBtn.setOnClickListener(new Button.OnClickListener() {

			@Override
			public void onClick(View v) {
				if (checkBox1.isChecked() == false
						&& checkBox2.isChecked() == false) {
					mHelper.setStyle(Style.ALERT);
					mHelper.setText("이용약관 & 정보제공 이용에 동의해주세요");
					mHelper.show();
				} else if (checkBox1.isChecked() == false) {
					mHelper.setStyle(Style.ALERT);
					mHelper.setText("이용약관에 동의해주세요");
					mHelper.show();
				} else if (checkBox2.isChecked() == false) {
					mHelper.setStyle(Style.ALERT);
					mHelper.setText("정보제공 이용에 동의해주세요");
					mHelper.show();
				} else {

					Intent myIntent = new Intent(getApplicationContext(),
							RegisterSecondActivity.class);
					startActivity(myIntent);

				}
			}

		});
	}

}
